Crate phaneron_plugin
source ·Expand description
This module defines the interfaces to be implemented for a Phaneron plugin to be successfully loaded.
To create a plugin you must have a function annotated with the #[export_root_module]
from the abi_stable
crate.
This function should return a PhaneronPluginRootModule
which acts as the handle which can be used to initialize
your plugin. This first function should not perform any additional work such as loading assets etc. as your plugin will be given
an opportunity to initialize itself later.
You should then have a load
function that is annotated using the #[sabi_external_fn]
macro from the abi_stable
crate.
This function is the initializer for your plugin and is where you can load assets that are globally required and pre-allocate
large amounts of memory if required. This function is allowed to fail and will only be called once. If it fails then the plugin
will not be loaded and Phaneron will not attempt to load the plugin again. If failing, please return some useful error message.
#[export_root_module]
fn instantiate_root_module() -> PhaneronPluginRootModuleRef {
PhaneronPluginRootModule { load }.leak_into_prefix()
}
#[sabi_extern_fn]
pub fn load(context: PhaneronPluginContext) -> RResult<PhaneronPlugin, RString> {
log::set_logger(phaneron_plugin::get_logger(&context)).unwrap();
log::set_max_level(LevelFilter::Trace);
let plugin = DemoPlugin {};
ROk(PhaneronPlugin_TO::from_value(plugin, TD_Opaque))
}
The returned plugin
is of type DemoPlugin
in this instance, which implements the PhaneronPlugin
trait. This object will be
used to create nodes from your plugin and manage its lifecycle. Refer to the documentation of PhaneronPlugin
.
Modules
- This module is generated by the
#[sabi_trait]
attribute on PhaneronLoggingContext - This module provides aliases for the trait objects generated by
abi_stable
for traits annotated withsabi_trait
.
Structs
- An audio frame along with its associated output Id.
- Defines the transformation function for a colourspace. May be used to define custom colour spaces.
- The trait object for PhaneronLoggingContext.
- Context passed to plugins, currently only serves as a way to provide a logging contet.
- Describes the entrypoint for a plugin.
- This is the pointer to the prefix of
PhaneronPluginRootModule
. - This is the prefix fields of
PhaneronPluginRootModule
, accessible throughPhaneronPluginRootModuleRef
, with.0.prefix()
. - Provides logging to a plugin. It can be set as the default logger for the
log
trait by callinginit
. - Parameters to be passed to a process shader. Each call to a
set_param_
function will push a parameter of that type to the arguments list, so calls should be made in the order in which parameters are required to be sent to the shader. - A video frame along with its associated output Id.
Enums
- Supported audio channel layouts.
- Supported audio I/O formats. Audio will be converted to 32 bit floating-point on input.
- Built-in colour space definitions.
- Supported interlacing modes.
- This should not be used by plugins, it is consumed by Phaneron to carry log messages across the FFI boundary.
- Available shader parameter types, these do not need to be directly consumed by plugins.
- Supported pixel packing formats.
Constants
- Colour space transformation for BT.601 (525 lines). Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf
- Colour space transformation for BT.601 (625 lines). Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.601-7-201103-I!!PDF-E.pdf
- Colour space transformation for BT.709. Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.709-6-201506-I!!PDF-E.pdf
- Colour space transformation for BT.709. Reference: https://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-2-201510-I!!PDF-E.pdf
- Colour space transformation for sRGB using kR and kB values from BT.709. Reference: https://en.wikipedia.org/wiki/SRGB
Traits
- This trait is used to allow the logger to be used across the FFI boundary. It should not be consumed by plugins.
Functions
- Returns the logger for a plugin which can then be used to pass log messages to Phaneron.
Type Definitions
- A type alias for the const-constructible
PhaneronLoggingContext_TO
.